package com.ruoyi.yun.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.yun.domain.YunProfileItttag;
import com.ruoyi.yun.service.IYunProfileItttagService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 机构标签管理Controller
 * 
 * @author ruoyi
 * @date 2023-10-24
 */
@RestController
@RequestMapping("/yun/itttag")
public class YunProfileItttagController extends BaseController
{
    @Autowired
    private IYunProfileItttagService yunProfileItttagService;

    /**
     * 查询机构标签管理列表
     */
    @PreAuthorize("@ss.hasPermi('yun:itttag:list')")
    @GetMapping("/list")
    public TableDataInfo list(YunProfileItttag yunProfileItttag)
    {
        startPage();
        List<YunProfileItttag> list = yunProfileItttagService.selectYunProfileItttagList(yunProfileItttag);
        return getDataTable(list);
    }

    /**
     * 导出机构标签管理列表
     */
    @PreAuthorize("@ss.hasPermi('yun:itttag:export')")
    @Log(title = "机构标签管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, YunProfileItttag yunProfileItttag)
    {
        List<YunProfileItttag> list = yunProfileItttagService.selectYunProfileItttagList(yunProfileItttag);
        ExcelUtil<YunProfileItttag> util = new ExcelUtil<YunProfileItttag>(YunProfileItttag.class);
        util.exportExcel(response, list, "机构标签管理数据");
    }

    /**
     * 获取机构标签管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('yun:itttag:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(yunProfileItttagService.selectYunProfileItttagById(id));
    }

    /**
     * 新增机构标签管理
     */
    @PreAuthorize("@ss.hasPermi('yun:itttag:add')")
    @Log(title = "机构标签管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody YunProfileItttag yunProfileItttag)
    {
        return toAjax(yunProfileItttagService.insertYunProfileItttag(yunProfileItttag));
    }

    /**
     * 修改机构标签管理
     */
    @PreAuthorize("@ss.hasPermi('yun:itttag:edit')")
    @Log(title = "机构标签管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody YunProfileItttag yunProfileItttag)
    {
        return toAjax(yunProfileItttagService.updateYunProfileItttag(yunProfileItttag));
    }

    /**
     * 删除机构标签管理
     */
    @PreAuthorize("@ss.hasPermi('yun:itttag:remove')")
    @Log(title = "机构标签管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(yunProfileItttagService.deleteYunProfileItttagByIds(ids));
    }
}
